#!/usr/bin/perl

use Env;

my $path, $fs, $sb, $hb, $sf, $hf, $user, @line;

foreach (@ARGV)
{
	if(/path=(.*)/)
	{
		$path = $1;
	}
	if(/user=(.*)/)
	{
		$user = $1;
	}
	if(/fs=(.*)/)
	{
		$fs = $1;
	}
	if(/sb=(.*)/)
	{
		$sb = $1;
	}
	if(/hb=(.*)/)
	{
		$hb = $1;
	}
	if(/sf=(.*)/)
	{
		$sf = $1;
	}
	if(/hf=(.*)/)
	{
		$hf = $1;
	}
}
#$path="/usr/libexec/webmin/quotamin/";
$ENV{"VISUAL"}="$path/edquota.pl";
$ENV{"QUOTA_FILESYS"}= $fs;
$ENV{'QUOTA_USER'} = $user;

$ENV{'QUOTA_SBLOCKS'} = $sb;
$ENV{'QUOTA_HBLOCKS'} = $hb;
$ENV{'QUOTA_SFILES'} = $sf;
$ENV{'QUOTA_HFILES'} = $hf;

#$user = "esteem\\mhy";
#print $user, "\n";

@line = split(/\\+/, $user);

#$user = join("\\\\", @line);
$user = join("\\", @line);

#print $user, "\n";

system("edquota", "-u", "$user");

#$ENV{"QUOTA_BTIME"}=15;
#$ENV{"QUOTA_BUNITS"}=3;
#$ENV{"QUOTA_FTIME"}=15;
#$ENV{"QUOTA_FUNITS"}=3;
#system("edquota -u -t");

#$ENV{"VISUAL"}= "$path/edgrace.pl";
#$ENV{"QUOTA_FILESYS"}= $fs;
#$ENV{"QUOTA_BTIME"}=$bt;
#$ENV{"QUOTA_BUNITS"}=$bu;
#$ENV{"QUOTA_FTIME"}=$ft;
#$ENV{"QUOTA_FUNITS"}=$fu;
#system("edquota -u -t");
